﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StringExtensions
{
    public static class StringExtensions
    {
        /// <summary>
        /// Parses a command given in the format "COMMAND ( Par1, Par2 ...)"
        /// </summary>
        /// <param name="input">The string containing the command.</param>
        /// <returns></returns>
        public static Command ParseCommand( this string input)
        {
            if (input == null)
            {
                throw new NullReferenceException("String cannot be null!");
            }
            
            if (input.Equals(String.Empty))
            {
                throw new IndexOutOfRangeException("String must cannot be empty!");
            }

            Command command = new Command(input);

            return command;
        }
    }
}
